//
//  JQFYTIcketGroupTableViewCell.m
//  JQFY
//
//  Created by apple on 2017/9/11.
//  Copyright © 2017年 yannis. All rights reserved.
//
#import "JQFYTIcketGroupTableViewCell.h"

@interface JQFYTIcketGroupTableViewCell ()
@property (nonatomic ,strong) UIImageView *iconImg;
@property (nonatomic ,strong) UILabel     *groupName;
@property (nonatomic ,strong) UILabel     *groupNum;
@property (nonatomic ,strong) UILabel     *groupInfo;
@property (nonatomic ,strong) UIView      *cotantView;
@end

@implementation JQFYTIcketGroupTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}
-(void)setupUI{
    _cotantView = [[UIView alloc]init];
    [self.contentView addSubview:_cotantView];
    [_cotantView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).mas_offset(10);
        make.top.bottom.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).mas_offset(-10);
    }];
    _cotantView.layer.cornerRadius = 5;
    _cotantView.layer.masksToBounds = YES;
    _cotantView.layer.borderWidth = 1;
    _cotantView.layer.borderColor = RGBCOLOR(92, 35, 156).CGColor;
    
    //icon图
    UIImage *icon = [UIImage imageNamed:@"icon_group"];
    self.iconImg = [[UIImageView alloc] initWithImage:icon];
    //群名
    NSString *groupStr = @"--群聊名--2017 电音节 无与伦比";
    self.groupName = [[UILabel alloc] init];
    self.groupName.font = [UIFont fontWithName:@"Arial-BoldMT" size:11];
    self.groupName.textColor = [UIColor whiteColor];
    self.groupName.text = groupStr;
    //人数
    NSString *groupNumStr = @"120人";
    self.groupNum = [[UILabel alloc] init];
    self.groupNum.font = [UIFont fontWithName:@"Arial-BoldMT" size:9];
    self.groupNum.textColor = [UIColor whiteColor];
    self.groupNum.text = groupNumStr;
    //详情
    NSString *groupInfoStr = @"-活动详情-在上海东方体育中心举行";
    self.groupInfo = [[UILabel alloc] init];
    self.groupInfo.font = [UIFont fontWithName:@"Arial-BoldMT" size:10];
    self.groupInfo.textColor = [UIColor whiteColor];
    self.groupInfo.text = groupInfoStr;
    
    [_cotantView addSubview:_groupInfo];
    [_cotantView addSubview:_groupNum];
    [_cotantView addSubview:_groupName];
    [_cotantView addSubview:_iconImg];
    [self setupframe];
}

-(void)setupframe
{
    [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.top.mas_equalTo(_cotantView);
        make.width.mas_offset(45);
    }];
    //添加图片
    UIImageView *addImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_add"]];
    [_cotantView addSubview:addImg];
    [addImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_offset(20);
        make.height.mas_offset(13);
        make.centerY.mas_equalTo(_cotantView);
        make.right.equalTo(_cotantView).offset(-15);
    }];
    [self.groupNum mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_cotantView);
        make.left.mas_equalTo(self.iconImg.mas_right).mas_offset(20);
        make.width.mas_offset(50);
    }];
    [self.groupName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.groupNum.mas_top).mas_offset(-5);
        make.left.mas_equalTo(self.iconImg.mas_right).mas_offset(20);
        make.width.mas_offset(200);
    }];
    [self.groupInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.groupNum.mas_bottom).mas_offset(5);
        make.left.mas_equalTo(self.iconImg.mas_right).mas_offset(20);
        make.width.mas_offset(200);
    }];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
